package com.ruoyi.system.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.LhkHotelReview;
import com.ruoyi.system.service.ILhkHotelReviewService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 评价信息管理Controller
 * 
 * @author lhk
 * @date 2025-05-29
 */
@RestController
@RequestMapping("/system/review")
public class LhkHotelReviewController extends BaseController
{
    @Autowired
    private ILhkHotelReviewService lhkHotelReviewService;

    /**
     * 查询评价信息管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:review:list')")
    @GetMapping("/list")
    public TableDataInfo list(LhkHotelReview lhkHotelReview)
    {
        startPage();
        List<LhkHotelReview> list = lhkHotelReviewService.selectLhkHotelReviewList(lhkHotelReview);
        return getDataTable(list);
    }

    /**
     * 导出评价信息管理列表
     */
    @PreAuthorize("@ss.hasPermi('system:review:export')")
    @Log(title = "评价信息管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, LhkHotelReview lhkHotelReview)
    {
        List<LhkHotelReview> list = lhkHotelReviewService.selectLhkHotelReviewList(lhkHotelReview);
        ExcelUtil<LhkHotelReview> util = new ExcelUtil<LhkHotelReview>(LhkHotelReview.class);
        util.exportExcel(response, list, "评价信息管理数据");
    }

    /**
     * 获取评价信息管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:review:query')")
    @GetMapping(value = "/{reviewId}")
    public AjaxResult getInfo(@PathVariable("reviewId") Long reviewId)
    {
        return success(lhkHotelReviewService.selectLhkHotelReviewByReviewId(reviewId));
    }

    /**
     * 新增评价信息管理
     */
    @PreAuthorize("@ss.hasPermi('system:review:add')")
    @Log(title = "评价信息管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody LhkHotelReview lhkHotelReview)
    {
        return toAjax(lhkHotelReviewService.insertLhkHotelReview(lhkHotelReview));
    }

    /**
     * 修改评价信息管理
     */
    @PreAuthorize("@ss.hasPermi('system:review:edit')")
    @Log(title = "评价信息管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody LhkHotelReview lhkHotelReview)
    {
        return toAjax(lhkHotelReviewService.updateLhkHotelReview(lhkHotelReview));
    }

    /**
     * 删除评价信息管理
     */
    @PreAuthorize("@ss.hasPermi('system:review:remove')")
    @Log(title = "评价信息管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{reviewIds}")
    public AjaxResult remove(@PathVariable Long[] reviewIds)
    {
        return toAjax(lhkHotelReviewService.deleteLhkHotelReviewByReviewIds(reviewIds));
    }
}
